using System;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using Beetle;

internal class b
{
	public bool a;

	public string b;

	public string c;

	public int d;

	public DateTime e;

	private static p m_f = null;

	private static object m_g = null;

	private static string h;

	private static string i;

	private static char[] j = new char[2] { '\r', '\n' };

	public static bool f(string A_0, string A_1)
	{
		return f(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
	}

	public static bool f(byte[] A_0, byte[] A_1)
	{
		return ((RSACryptoServiceProvider)global::b.m_g).VerifyData(A_0, "MD5", A_1);
	}

	public static string g(string A_0)
	{
		return Encoding.UTF8.GetString(f(Convert.FromBase64String(A_0)));
	}

	public static byte[] f(byte[] A_0)
	{
		return ((RSACryptoServiceProvider)global::b.m_g).Decrypt(A_0, fOAEP: false);
	}

	public static p f()
	{
		lock (typeof(p))
		{
			if (global::b.m_f == null)
			{
				global::b.m_f = new p();
				try
				{
					MethodInfo[] methods = typeof(z).GetMethods(BindingFlags.Static | BindingFlags.Public);
					foreach (MethodInfo methodInfo in methods)
					{
						if (methodInfo.GetCustomAttributes(typeof(a), inherit: false).Length > 0)
						{
							global::b.m_g = methodInfo.Invoke(null, null);
						}
					}
					FieldInfo[] fields = typeof(at).GetFields(BindingFlags.Static | BindingFlags.Public);
					foreach (FieldInfo fieldInfo in fields)
					{
						if (fieldInfo.GetCustomAttributes(typeof(f), inherit: false).Length > 0)
						{
							h = (string)fieldInfo.GetValue(null);
						}
					}
					FieldInfo[] fields2 = typeof(at).GetFields(BindingFlags.Static | BindingFlags.Public);
					foreach (FieldInfo fieldInfo2 in fields2)
					{
						if (fieldInfo2.GetCustomAttributes(typeof(y), inherit: false).Length > 0)
						{
							i = (string)fieldInfo2.GetValue(null);
						}
					}
					((RSACryptoServiceProvider)global::b.m_g).FromXmlString(f(i));
					string path = TcpUtils.h() + f(h);
					using StreamReader streamReader = new StreamReader(path);
					string[] array = streamReader.ReadToEnd().Split(j, StringSplitOptions.RemoveEmptyEntries);
					if (f(array[0], array[1]))
					{
						string[] array2 = Encoding.UTF8.GetString(Convert.FromBase64String(array[0])).Split(';');
						global::b.m_f.b = array2[0];
						global::b.m_f.c = array2[1];
						global::b.m_f.d = int.Parse(array2[2]);
						global::b.m_f.e = new DateTime(long.Parse(array2[3]));
						global::b.m_f.a = global::b.m_f.e > DateTime.Now;
					}
				}
				catch (Exception)
				{
				}
			}
		}
		return global::b.m_f;
	}

	internal static string f(string A_0)
	{
		ah ah2 = new ah();
		ah.a a2 = new ah.a();
		a2.a(Convert.FromBase64String(TcpServer.g));
		a2.b(Convert.FromBase64String(aq.z));
		ah2.a(a2);
		return ah2.b(A_0);
	}

	public bool f(int A_0)
	{
		if (a)
		{
			return A_0 <= d;
		}
		return false;
	}
}
